@model System.String
@using Telerik.Web.Mvc.UI

@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue.ToString(), new { @class = "text-box single-line ltr al url_" + ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty) })

<button id="feedback-open-button_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))" class="t-button t-state-default">...</button>
@{ Html.Telerik().ScriptRegistrar()
    .OnDocumentReady(@<text>
        $('#feedback-open-button_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))')
            .click(function(e) {
                e.preventDefault();
                $('#Window_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))').data('tWindow').center().open();
            });

        $('.t-button').live('mouseenter', $.telerik.buttonHover)
                        .live('mouseleave', $.telerik.buttonLeave);

        $("#Window_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)) .t-link").live("click", function () {
            var href = $(this).attr("href");
            if(href.indexOf("http://") != -1) href = href.replace(/^.*\/\/[^\/]+/, '');
            $(".url_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))").attr("value", href);
            $("#Window_@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))").data("tWindow").close();
            return false;
        });

    </text>); }

@{  Html.Telerik().Window()
    .Name("Window_" + ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
    .Title(@Html.R(VirtualPath, "Title"))
    .Content(@<text>
                @(Html.Telerik().TreeView()
                        .Name("AjaxTreeView")
                        .DataBinding(dataBinding => dataBinding
                            .Ajax().Enabled(true).Select("_TreeViewLoading", "Main")
                        )
                        .DragAndDrop(settings => settings
                            .DropTargets(".drop-container")
                        )
                )
        </text>)
    .Width(400)
    .Height(500)
    .Draggable(true)
    .Modal(true)
    .Visible(false)
    .Render();
} 